package cn.topevery.garden.dal.logic;

import cn.topevery.garden.dal.dao.EvaluationFileDao;
import cn.topevery.garden.entity.po.EvaluationFile;
import cn.topevery.garden.entity.query.EvaluationFileQuery;
import cn.topevery.garden.entity.vo.EvaluationFileVO;
import cn.topevery.garden.framework.base.BaseLogic;
import hw.topevery.framework.db.base.BaseEntityDao;
import hw.topevery.framework.db.entity.DataPager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 检查考评附件表
 *
 * @author code-generate
 * @date 2022-01-05
 */
@Service
public class EvaluationFileLogic extends BaseLogic<EvaluationFile> {
    @Autowired
    EvaluationFileDao evaluationFileDao;

    @Override
    public BaseEntityDao<EvaluationFile, Integer> getDao() {
        return evaluationFileDao;
    }

    

    /**
     * 获取列表
     *
     * @param query
     */
    public DataPager<EvaluationFileVO> listPage(EvaluationFileQuery query) {
        return evaluationFileDao.listPage(query);
    }

    /**
     * 根据自增id批量删除
     *
     * @param ids
     */
    public void deleteBatchById(String userId,Integer[] ids) {
        evaluationFileDao.delete(userId, ids);
    }

    /**
     * 根据自增id保存或者更新
     *
     * @param evaluationFile 实体
     */
    public void saveOrUpdate(String userId, EvaluationFile evaluationFile){
        evaluationFileDao.saveOrUpdate(userId,evaluationFile);
    }

    /**
         * 根据自定义列值来获取对象
         */
    public EvaluationFile getEntityByColumn(String key, String value) {
        return evaluationFileDao.getEntityByColumn(key, value);
    }

    public void deleteByLogId(Integer logId, Integer userId){
        evaluationFileDao.deleteByLogId(logId,userId);
    }

    public List<EvaluationFile> getFileListByLogId(Integer logId){
      return   evaluationFileDao.getFileListByLogId(logId);
    }

    public  void saveFiles(List<EvaluationFile> fileList){
        evaluationFileDao.saveFiles(fileList);
    }
}
